#include <glib.h>

static void test_print_uppercase_words (const gchar *string)
{
    // Print all uppercase-only words.
    GRegex *regex;
    GMatchInfo *match_info;

    regex = g_regex_new ("[A-Z]+", 0, 0, NULL);
    g_regex_match (regex, string, 0, &match_info);
    while (g_match_info_matches (match_info))
    {
        gchar *word = g_match_info_fetch (match_info, 0);
        g_print ("Found: %s in %s \n", word, string);
        g_free (word);
        g_match_info_next (match_info, NULL);
    }

    g_match_info_free (match_info);
    g_regex_unref (regex);
}

int main (int argc, char** argv)
{
    test_print_uppercase_words("Hello, World!");
    test_print_uppercase_words("hello, world!");
    test_print_uppercase_words("HELLO, world!");
    test_print_uppercase_words("HELLO, WORLD!");

  return 0;
}